#!/bin/bash
source /home/vlog_platform/venv/bin/activate
export LD_LIBRARY_PATH=/usr/local/python3913/lib:/usr/local/postgresql133/lib:$LD_LIBRARY_PATH

WEBSERVICE_NAME=webService.py
PAYSERVICE_NAME=payService.py
DATASERVICE_NAME=dataService.py
APPSERVICE_NAME=appService.py

webService_pid="`ps -ef |grep "$WEBSERVICE_NAME" |grep -v "grep" |awk '{print $2}'`"
pay_pid="`ps -ef |grep "$PAYSERVICE_NAME" |grep -v "grep" |awk '{print $2}'`"
app_pid="`ps -ef |grep "$APPSERVICE_NAME" |grep -v "grep" |awk '{print $2}'`"
data_pid="`ps -ef |grep "$DATASERVICE_NAME" |grep -v "grep" |awk '{print $2}'`"
 
if [ -n "$webService_pid" ];then
        kill -9 $webService_pid
        echo "webService.py已关闭"
else
    echo "webService.py未开启"
fi

if [ -n "$pay_pid" ];then
        kill -9 $pay_pid
        echo "payService.py已关闭"
else
        echo "payService.py未开启"
fi

if [ -n "$app_pid" ];then
        kill -9 $app_pid 
        echo "appService.py已关闭"
else
        echo "appService.py未开启"
fi

if [ -n "$data_pid" ];then
        kill -9 $data_pid 
        echo "dataService.py已关闭"
else
        echo "dataService.py未开启"
fi